home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Business Assistant
/
Business Assistant.iso
/
utility
/
par230
/
pom.inf
< prev
next >
Wrap
Text File
|
1993-01-03
|
18KB
|
503 lines
===============================================================================
========================== ============================
========================== PARSE-O-MATIC ============================
========================== ============================
===============================================================================
Parse-O-Matic is Copyright (C) 1992
by
Pinnacle Software, CP 386 Mount Royal, Quebec Canada H3P 3C6
U.S. Office: Box 714 Airport Road, Swanton, Vermont 05488 USA
Support Line (514) 345-9578 -- Free Files BBS (514) 345-8654
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
This is a SHAREWARE product. That means we would like you to
pass around unregistered copies to other people. If you have
a modem, please upload it to your favourite bulletin board
system, or give a copy to a friend who you think might need
a program like this. Shareware means sharing! Pass it on!
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Design and coding: Timothy Campbell
Marketing: James Ludwick
Paul Renault
Documentation: Natasha Mirage
Distribution: Kevin Beck
Support services: L. Wilson
Z. Krome
P. Katt
===============================================================================
INTRODUCTION
===============================================================================
WHY YOU NEED PARSE-O-MATIC
--------------------------
There are plenty of programs out there that have valuable data locked away
inside them. How do you get that data OUT of one program and into another one?
Some programs provide a feature which "exports" a file into some kind of
generic format. Perhaps the most popular of these formats is known as a
"comma-delimited file", which is a text file in which each data field is
separated by a comma. Literal strings -- which might contain commas! -- are
represented in double quotes. So a few lines from a comma-delimited file might
look something like this (an export from a hypothetical database of people who
owe your company money):
+----------------------------------------------------------------+
| "JONES","FRED","1234 GREEN AVENUE", "KANSAS CITY", "MO",293.64 |
| "SMITH","JOHN","2343 OAK STREET","NEW YORK","NY",22.50 |
| "WILLIAMS","JOSEPH","23 GARDEN CRESCENT","TORONTO","ON",16.99 |
+----------------------------------------------------------------+
Unfortunately, not all programs export data in this format, and not all
programs READ data in that format. What's most annoying of all is when one
program exports data in a format that is ALMOST what you need!
If that's the case, you might find that it's worth your while to spend a few
hours in a text editor, modifying the export file so that the other program
can understand it. Or you might write a program to do the editing for you.
Both solutions are time-consuming.
An even more challenging problem arises when a program which has no export
capability DOES have the ability to "print" reports to a file. You can write a
program to read these files and convert them to something you can use, but this
can be a LOT of work!
PARSE-O-MATIC TO THE RESCUE!
----------------------------
Parse-O-Matic is a utility that interprets text files and converts them to
other formats. It can help you "boil down" reports into their essential data.
You can also use it to convert NEARLY compatible file formats.
HOW IT WORKS
------------
You need three things:
1) The Parse-O-Matic program
2) A Parse-O-Matic "POM" file (to tell Parse-O-Matic what to do)
3) The input file
The input file is usually a report from another program. We've provided
several examples of typical input files. For example, the file EXAMPLE2.TXT
comes from the AccPac accounting software. AccPac is a great program, but its
export capabilities leave something to be desired. Parse-O-Matic can help!
===============================================================================
HOW TO CODE THE POM FILE
===============================================================================
This documentation assumes that you are an experienced computer user. If you
have trouble, you might ask a programmer to help you -- POM file creation is
a little like programming!
THE PARSE-O-MATIC COMMAND
-------------------------
The format of the Parse-O-Matic command line is:
POM pom-file input-file output-file
Here's an example, as you would type it at the DOS command line:
POM POMFILE.POM REPORT.TXT OUTPUT.TXT
For a more formal description of the command line, start up POM by typing this
command at the DOS prompt:
POM
THE POM FILE
------------
The POM file is a text file with a .POM extension. The following conventions
are used when interpreting the POM file:
- Null lines and lines starting with a semi-colon are ignored.
- A POM file may contain up to 500 lines of specifications.
Comment lines do not count in this total.
A POM file contains no "loops" (to use the programming term). Each line of the
input file is processed by the entire POM file. If you'd like it expressed in
terms of programming languages, here's what POM does:
+----------------------------------------------------------------+
| START: If there's nothing left in the input file, go to QUIT. |
| Read a line from the input file |
| Do everything in the POM file |
| Go to START |
| QUIT: Tell the user you're finished! |
+----------------------------------------------------------------+
PADDING FOR CLARITY
-------------------
Spaces and tabs between the words and variables in a POM file line are
generally ignored (except in the case of the OUT and OUTEND commands). You
can use spaces to make the POM file easier to read.
Additionally, in any line in the POM file, the following terms are ignored:
= THEN ELSE
These can be added to make the lines easier to read. For example, the IF
command can be written in any of the following ways:
Very terse: IF PRICE "0.00" BONUS "0.00" "1.00"
Padded with spaces: IF PRICE "0.00" BONUS "0.00" "1.00"
Fully padded: IF PRICE = "0.00" THEN BONUS = "0.00" ELSE "1.00"
COMMAND WORDS
-------------
For ease of learning, the commands words are presented in the following order:
MINLEN SET IGNORE ACCEPT IF TRIM PAD INSERT CHANGE OUT OUTEND
MINLEN number
Specifies the minimum length a line must be to be considered for parsing.
(Note that null lines in the input file are always ignored) If you omit
the MINLEN command, the minimum length is assumed to be 1. That is to
say, all lines longer than 1 character will be processed.
MINLEN is useful for ignoring brief information lines that clutter up a
report that you are parsing. For example, in the sample file EXAMPLE2.POM,
the MINLEN command is set to 85 to ensure that all lines shorter than 85
characters long will be ignored. This simplifies the coding considerably.
SET var1 value1
This assigns a value to a variable. The usual reason to do this is to
set a variable from the input line ($FLINE) prior to cleaning it up wit